OTV Miner X-Box Version


7. XBOX Version


Our final goal for the OTV Miner was to upload the code to an XBOX to take advantage of the multi-platform coding offered by the XNA Framework. After downloading the XNA Game Studio Connect to the XBOX, uploading the game was simple. Inside of Visual Studio, we simply created a copy of the game for XBOX and then built it. Once the connection is made from the XBOX and PC, the program is automatically deployed.

Problems Encountered

We experience one major problem with our original PC design while porting the code to an XBOX version. Controlling the ship was not as simple as we had thought with the XBOX controller. This is due to the nature of thumb-sticks on the controller acting like joysticks instead of buttons. This caused us to modify the way the user interacted with ship. We split the rotation and movement of the ship between the two thumb-sticks on the controller to give the user a better game play.

this.Rotation -=     gamePad.ThumbSticks.Right.X *.1f;
this.YPos -= (float)Math.Sin(this.Rotation) * gamePad.ThumbSticks.Left.Y * this.Speed * SCALE;
this.XPos += (float)Math.Sin(this.Rotation) * gamePad.ThumbSticks.Left.Y * this.Speed * SCALE;
 
The above code is taken from MoveShip method in the ShipObject Class and shows the new controls. This code is not the complete solution, it still leaves the ship controls a bit awkward and, if we were releasing this game to the open public, would need more refining.

The other problems we encountered all where derived from controller-to-code interaction (IO). Basically any place in the code that used the keyboard for inputs, had to be sectioned off and new code added for the XBOX controller IO. The code logic was still the same, but merely we had to substitute KeyboardState objects with equivalent GamePadState objects. We have chosen not to include these minor changes in our report, but can be viewed in the solution posted to the class FTP.

Conclusion

Porting code written in the XNA language from a PC version to a XBOX version was relatively simple. This project being the first we had done caused multiple IO problems, but we now know exactly how the XBOX controller interacts with the code and in any future designs, this could be minimized.


Project Home